using System;
using System.Globalization;

namespace WindowsPhone.CompactContainer.ServiceLocation.CompactContainer
{
    /// <summary>
    /// The life style of the object
    /// </summary>
    public enum LifestyleType
    {
        /// <summary>
        /// 
        /// </summary>
        Singleton,

        /// <summary>
        /// 
        /// </summary>
        Transient,
    }

    /// <summary>
    ///  
    /// </summary>
    public class ComponentInfo
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentInfo"/> class.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="classType">Type of the class.</param>
        /// <param name="lifestyle">The lifestyle.</param>
        public ComponentInfo(string key, Type serviceType, Type classType, LifestyleType lifestyle)
        {
            Key = key;
            ServiceType = serviceType;
            ClassType = classType;
            Lifestyle = lifestyle;
        }

        /// <summary>
        /// Gets the key.
        /// </summary>
        /// <value>The key.</value>
        public string Key { get; private set; }

        /// <summary>
        /// Gets the type of the service.
        /// </summary>
        /// <value>The type of the service.</value>
        public Type ServiceType { get; private set; }

        /// <summary>
        /// Gets the classtype.
        /// </summary>
        /// <value>The classtype.</value>
        public Type ClassType { get; private set; }

        /// <summary>
        /// Gets the lifestyle.
        /// </summary>
        /// <value>The lifestyle.</value>
        public LifestyleType Lifestyle { get; private set; }

        /// <summary>
        /// Gets or sets the instance.
        /// </summary>
        /// <value>The instance.</value>
        public object Instance { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is resolving dependencies.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is resolving dependencies; otherwise, <c>false</c>.
        /// </value>
        public bool IsResolvingDependencies { get; set; }

        /// <summary>
        /// Converts to a string
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentCulture, "Key:{0} - Service:{1} - Class:{2}", Key, ServiceType.Name, ClassType.Name);
        }
    }
    
}